package com.yanfan.energybilling.controller;

import com.yanfan.common.annotation.Anonymous;
import com.yanfan.common.core.domain.AjaxResult;
import com.yanfan.energybilling.service.DeviceThingsEnergyService;
import com.yanfan.energybilling.service.EnergyManagementDashboardService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

/**
 * @author fuhao
 * @date 2025年09月01日 12:03
 *
 */
@RestController
@RequestMapping("/energyIndex")
@Api(tags = "能源管理看板")
public class EnergyManagementDashboardController {

    @Autowired
    private EnergyManagementDashboardService energyManagementDashboardService;

    /**
     * 获取 电总用能，水总用能，气总用能
     *
     * @return
     */
    @Anonymous
    @GetMapping("/sumDifferenceValue")
    public AjaxResult energyTop() {
        return AjaxResult.success(energyManagementDashboardService.totalDifferenceValueGroupByEnergyType());
    }


    /**
     * 水电气图表
     * timeType day，month，year
     * energyType 水、电、气
     * @return
     */
    @Anonymous
    @GetMapping("/echarts/{timeType}/{energyType}")
    public AjaxResult echarts(@PathVariable String timeType, @PathVariable String energyType) {
        return AjaxResult.success(energyManagementDashboardService.echarts(timeType, energyType,null));
    }

    /**
     * 智慧照明--当月用电统计
     * timeType day，month，year
     * energyType 水、电、气
     * @return
     */
    @Anonymous
    @GetMapping("/currentMonthElectricityStatistics/{timeType}/{energyType}/{allLights}")
    public AjaxResult currentMonthElectricityStatistics(@PathVariable String timeType, @PathVariable String energyType, @PathVariable List<String> allLights) {

        return AjaxResult.success(energyManagementDashboardService.echarts(timeType, energyType,allLights));
    }


    /**
     * 区域用能占比
     * @return
     */
    @Anonymous
    @GetMapping("/regionalEnergyConsumption")
    public AjaxResult RegionalEnergyConsumption() {
        return AjaxResult.success(energyManagementDashboardService.regionalEnergyConsumption());
    }




}
